<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Handlers\GetViewCountHandler;
class TestViewCounts extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'zhuanfa:test-view-count {user_ids}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '测试用户数据获取';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle(GetViewCountHandler $view)
    {
        $this->info("开始执行...");
        $userId = $this->argument('user_ids');
        if ($data = $view->get($userId)) {
            $this->info('获取到浏览量！');
            $this->table(['id', 'date', 'iv'], $data);
          } else {
            $this->error('浏览量获取失败！');
          }
    }
}
